package com.study.designer.creator.builder;

public class User {
    private String name;
    private Integer age;
    private Integer gender;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public Integer getGender() {
        return gender;
    }

    public void setGender(Integer gender) {
        this.gender = gender;
    }

    public static UserBuilder builder(){
        return new UserBuilder();
    }

    @Override
    public String toString() {
        return "User{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", gender=" + gender +
                '}';
    }

    public static class UserBuilder{
        private User user = new User();

        public UserBuilder name(String name){
            user.setName(name);
            return this;
        }

        public UserBuilder age(Integer age){
            user.setAge(age);
            return this;
        }

        public UserBuilder gender(Integer gender){
            user.setGender(gender);
            return this;
        }

        public User build(){
            return user;
        }
    }
}
